(1) Field of the Invention
The present invention relates to an instruction conversion apparatus and a method of converting an instruction which provide an object program with a power control information, a program and a circuit for implementing the instruction conversion, furthermore a microprocessor for executing the converted instruction; in microprocessors (including microcomputer, microcontroller and digital signal processor) which read an object program out of an instruction storage unit (instruction memory, instruction cache, etc.), decode it at a decoder to control the hardware resources (processing unit, input unit, output unit, memory unit, control unit, etc) in accordance with the contents and proceed a sequence processing.
(2) Description of the Background Art
Among the microprocessors, there have been two methods of controlling the electric power for saving the power consumption; one method is that through hardware, the other is that through software.
First, a conventional method of controlling the power through hardware is described. In a typical operation of a microprocessor, an instruction decoder acquires instruction code from an instruction memory unit along with progress of a program, decodes the instruction code, and controls the processing operations in accordance with respective instructions. In the power control through hardware, an instruction decoder for extracting information regarding the power control is built in the microprocessor.
FIG. 14 shows an example of circuitry for controlling the power in a microprocessor through hardware. As soon as an instruction decoder 1401 receives from an instruction memory 1402 an instruction code which instructs addition between registers, the decoder judges that data memory and the peripheral interface will not be put into operation while the relevant instruction code is being executed. Every time when the instruction decoder 1401 receives an instruction of addition between registers, it issues to respective circuits an instruction to halt operation of data memory, peripheral interface, etc. Thus the power control is conducted with respect to the instruction of addition between registers. Besides, the decoder is structured so that it can decode the power control information in accordance with kinds of instruction codes, such as a subtraction instruction, a read out instruction, etc. Thereby, power control instruction is issued to reduce the power consumption, at each time when various instruction codes are decoded.
Next, a conventional method of controlling the power through software is described. In the method of control through software, a user describing a program judges as to which of the hardware resources can be halted while microprocessor is executing an object program, and writes a power control instruction direct in the program.
FIG. 15 is an example of program for the power control in a microprocessor through software. In the present example, the data memory is not used in a region 1501. User inserts an instruction to halt (decrease the power of) the data memory at a point 1502, and an instruction to release (increase the power of) the data memory from the halt at a point 1503 which is just before the data memory is put into operation again. Thus the data memory is halted in the region 1501 by the above two instructions. Although only a data memory is exemplified in the above, any other circuits of a microprocessor can be controlled in this way; the circuits including data register, data bus, peripheral interface, even those of the circuit element level e.g. AND. Even in the power control method through software, the real power control within a microprocessor is conducted by writing a power control instruction, which has been decoded at an instruction decoder, in a power control register.
In a power control method through hardware, the decoder needs to be structured so that it can decode power control information corresponding to various instruction codes. This naturally expands the size of hardware to a large scale, if a thorough power control is to be performed. Furthermore, if there are many kinds of decodable instructions, power consumption needed for the decoding operation increases. This might result in an increased total power consumption of a microprocessor. Still further, since a power control information can only be extracted at each unit of instruction codes, it is not possible to perform an advanced power control to a succeeding instruction.
In a power control method through software, user is requested to judge as to what time the power control is to be started and ended, and write a power control instruction accordingly into a program. Thus, the development burden of a user is substantial. Furthermore, when number of the point of control increases, it turns out to be difficult to write thorough instructions. Still further, targets of the power control may differ depending on structure of a microprocessor, viz. the memory structure, number of peripheral interface ports, etc. In such a case, an exclusive program will be needed by each of the models. So, it is difficult to share a program in common, or use a program also for other applications. Furthermore, when a number of the power control instructions are written at a point of multiloop or frequent execution, speed of program execution goes down.